package com.knowledge.review.concurrencyReview;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @author XFW
 * @date 22:48 2024/6/12
 * @description 异步多线程接口
 **/
public class FutureReview {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<String> futureTask = new FutureTask<>(new Mythread());
        Thread thread = new Thread(futureTask);
        thread.start();
        System.out.println(futureTask.get());
//        new Thread(futureTask).start();
    }
}
class Mythread implements Callable<String> {

    @Override
    public String call() {
        System.out.println("-----come in call");
        return "hello world callable";
    }
}
